package lysjmaster.base.auth.domain;


import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lysjmaster.base.common.spring.base.BaseEntity;
import lysjmaster.base.common.spring.jpa.JpaPredicate;
import lysjmaster.base.common.spring.jpa.PredicateEnum;
import lysjmaster.base.common.validation.annotation.Length;
import lysjmaster.base.common.validation.annotation.NotBlank;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;

/**
 * @author zk
 * @description 用户表
 * @create 2018-07-25 14:55
 **/
@Data
@Entity
@EqualsAndHashCode(callSuper = true)
@Table(name = "lysj_auth_user")
public class User extends BaseEntity {

    @Getter
    public enum SEX {
        MAN(1, "男"),
        WOMEN(2, "女");

        private Integer code;
        private String status;

        SEX(Integer code, String status) {
            this.code = code;
            this.status = status;
        }
    }

    @NotBlank(message = "请填写用户名")
    private String username;//用户名，登录账号，必填

    @JsonIgnore
    @NotBlank(message = "请填写密码")
    @Length(min = "6",max = "16",minEqual = true,maxEqual = true,message = "请输入6-16位密码")
    private String password;//密码 必填

    private String phone;//联系电话 选用

    private String email;//邮箱 选用

    private Integer age;

    private Integer sex = SEX.MAN.code;//员工性别

    @NotBlank(message = "请选择角色")
    private String roleId;

}
